Repository navigation
fix(bind): report a reachable LAN address for wildcard binds - #207
Closed
abu-tahir-0 wants to merge 1 commit into
Closed
abu-tahir-0 wants to merge 1 commit into
abu-tahir-0 wants to merge 1 commit into
Conversation
The pairing URL was built from the bind host verbatim, so --bind 0.0.0.0 (or ::) produced http://0.0.0.0:8765/ — an address no phone can open. That is now the common case on macOS, which binds 0.0.0.0 by default. url_for now substitutes a wildcard bind with the host's LAN IPv4 (default-route source address, then host-name lookup) and falls back to 127.0.0.1 when none is found. `addresses` still lists the raw bound sockets; only `url` changes. Literal and iface: binds are untouched. The discovery hook is injectable so the regression tests never touch the network (jonocodes#206).
Owner
|
Note 🤖 Claude Opus 5.5 responding on behalf of jonocodes Closing this as superseded by #208, which fixed #206 and merged today. This PR came first: it was open ~14 hours before #208, and #208 was filed without checking for an existing PR. That's on us, not you. The two take the same approach (default-route source address, then hostname lookup, then loopback), so your read of the problem was right. The one behavioural difference is the bare
#208 made the same If you'd like to keep contributing, issues labelled |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
url_forbuilt the pairing URL from the bind host verbatim, so--bind 0.0.0.0(or::) reportedhttp://0.0.0.0:8765/on/health,/diag, anddeckctl status. A phone cannot open that address. Since #204 the macOS app binds0.0.0.0by default, so this is now the common case. Closes #206.Root cause
bind.url_forselected the preferred resolved bind and formatted its host unchanged. A literal0.0.0.0/::resolves to itself, so the wildcard leaked into the URL.addressesis correct either way; only the single pairing URL is wrong.Solution
url_fornow detects an unspecified address (ipaddress.is_unspecified) and substitutes a reachable IPv4: the source address of the default route (a connected UDP socket, which sends nothing), then a host-name lookup; if neither yields a usable address it falls back to127.0.0.1. Never returns a wildcard.::bind with an IPv4 substitution is rendered unbracketed.lan_hostkeyword hook so tests inject a stub and never touch the network.addressesand concrete/iface:binds are unchanged.CONTEXT.md,docs/GUIDE.md, anddocs/REFERENCE.mddescribe the wildcard handling.Testing
python -m pytest tests/test_bind.py -q→ 28 passed (5 new: IPv4 wildcard, IPv6 wildcard, loopback fallback, concrete bind skips discovery, default discovery hook).python -m pytest tests/test_bind_surface.py -k "health or diag" tests/test_diag_endpoints.py -q→ 23 passed.pyright daemon/deckd/bind.py→ 0 errors.The full suite cannot run on my Windows machine:
tests/test_install_helper.pyimportsos.geteuidat module scope, andtest_start_port_in_use_with_multi_bind/ watcher tests block on this platform. Those are pre-existing and unrelated; Linux CI'sjust test-allshould confirm.Impact
Phones get a URL they can actually type when the daemon is bound to all interfaces. No change to auth,
addresses, or explicit binds.